<?php
/**
 * Html form
 *
 * @author dll_hell_2
 */
class form 
{
    protected $form_id;
    protected $items_array;
    protected $form_action;
    protected $form_method;
    protected $form_legend;
    public function __construct($form_id, $form_action, $form_method,$form_legend,$items_array) 
    {
        $this->form_id = $form_id;
        $this->form_action = $form_action;
        $this->form_method = $form_method;
        $this->items_array = $items_array;
        $this->form_legend = $form_legend;
    }
    public function __toString()
    {       
       $result = sprintf("<form id=\"%s\" action =\"%s\" method=\"%s\"><fieldset><legend>%s</legend><ul>",
               $this->form_id,
               $this->form_action,
               $this->form_method,
               $this->form_legend);
       foreach($this->items_array as $key => $val)
       {   
           $result .= sprintf("<li>%s</li><br />",
                   $val);
       }       
       $result .= sprintf("<input type=\"hidden\" name=\"%s\" value=\"true\"></ul></fieldset></form>",
               $this->form_id);
       return $result;
    }
}

?>
